package 方法的引用.练习;

import 方法的引用.Student;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

public class 练习二 {
    public static void main(String[] args) {
        ArrayList<Student> list=new ArrayList<>();
        Collections.addAll(list,new Student("zhangsan",23)
        ,new Student("lisi",24),new Student("wangwu",25));

        //获取姓名添加到数组当中
        String[] array = list.stream().map(Student::getName).toArray(String[]::new);
        System.out.println(Arrays.toString(array));
    }
}
